package com.mxf.code.abstract_factory;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
/**
 * @author zhangyifeng
 * @date 2021-10-16 17:25
 */
@RestController
@Slf4j
public class TestController {
 
    @Autowired
    PersonHandlerFactory personHandlerFactory;
 
    @GetMapping("/handler")
    public void testHandler(@RequestParam("code")Integer code){
        log.info("/handler code:{}",code);
        PersonHandler handler = personHandlerFactory.createHandler(code);
        handler.handle();
    }
}